﻿# coding: UTF-8
# Name:
# Author: LYC
# Created: 2014-03-26

import project
import pytest

@pytest.fixture
def exp_tokens():
    def _(exp):
        return tuple(project.get_exp_tokens(exp))
    return _

def test_get_exp_tokens(exp_tokens):
    assert exp_tokens("1+1") == ("1", "+", "1", "")
    assert exp_tokens("[1,5,9]") == ("[", "1", ",", "5", ",", "9", "]", "")
    assert exp_tokens("(1*24)") == ("(", "1", "*", "24", ")", "")
    assert exp_tokens("sin(45)") == ("sin", "(", "45", ")", "")
    assert exp_tokens("3.7 mod mod(4, 5)") == ("3.7", "mod", "mod", "(", "4", ",", "5", ")", "")
    assert exp_tokens(".7") == (".7", "")
    assert exp_tokens("-.5") == ("-", ".5", "")


def main():
    pytest.main("-x ./test.py")

if __name__ == '__main__':
    main()
